<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<script src="resources/currentSrcHelper.js"></script>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    addEventListener("DOMContentLoaded", function() {
        window.testdiv = document.createElement("div");
        window.testdiv.innerHTML = '<img id="foo" src="resources/blue-100-px-square.png" srcset="../../hidpi/resources/image-set-1x.png 200w, ../../hidpi/resources/image-set-2x.png 400w, resources/image-set-4x.png 800w">';
    }, false);
    addEventListener("load", function() {
        shouldBe('fileName(window.testdiv.children[0].currentSrc)', '"image-set-4x.png"');
    }, false);
</script>
<img id="foo">
